package com.ruoyi.play.config;

import lombok.Getter;

import java.util.HashMap;

public class StaticSourceConfig {

    private static final HashMap<String, String> STATIC_SOURCE_MAP = new HashMap<String, String>() {
        {
            put(PlayType.BASKETBALL.name(), "https://oss-tzf-mail.oss-cn-guangzhou.aliyuncs.com/play/lq.jpg");
            put(PlayType.FOOTBALL.name(), "https://oss-tzf-mail.oss-cn-guangzhou.aliyuncs.com/play/zq.jpg");
            put(PlayType.BADMINTON.name(), "https://oss-tzf-mail.oss-cn-guangzhou.aliyuncs.com/play/ymq.jpg");
            put(PlayType.PINGPONG.name(), "https://oss-tzf-mail.oss-cn-guangzhou.aliyuncs.com/play/ppq.jpg");
            put(PlayType.YOGA.name(), "https://oss-tzf-mail.oss-cn-guangzhou.aliyuncs.com/play/yj.jpg");
            put(PlayType.JUMPROPE.name(), "https://oss-tzf-mail.oss-cn-guangzhou.aliyuncs.com/play/ts.jpg");
            put(PlayType.RUNNING.name(), "https://oss-tzf-mail.oss-cn-guangzhou.aliyuncs.com/play/pb.jpg");
        }
    };

    @Getter
    public enum PlayType {
        BASKETBALL("篮球"),
        FOOTBALL("足球"),
        BADMINTON("羽毛球"),
        PINGPONG("兵乒球"),
        YOGA("瑜伽"),
        JUMPROPE("跳绳"),
        RUNNING("跑步"),
        ;
        private final String type;

        PlayType(String type) {
            this.type = type;
        }
    }

    @SuppressWarnings("uncheck")
    public static String getPlayTypeImage(String type) {
        PlayType[] values = PlayType.values();
        for (PlayType value : values) {
            if (value.getType().equals(type)) {
                return STATIC_SOURCE_MAP.get(value.name());
            }
        }
        // 没有的话就用默认图片
        return STATIC_SOURCE_MAP.get(PlayType.RUNNING.name());
    }
}
